package com.etop.pojo;

import java.io.Serializable;

import javax.persistence.*;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;

@SuppressWarnings("serial")
@Entity
@Table(name="t_permission")
public class Permission implements Serializable {
   private Integer id;
   private String permissionname;
   private Role role;
   public  Permission(){
	   super();
   }
   public Permission(Integer id,
		             String permissionname,
		             Role role){
	   super();
	   this.id=id;
	   this.permissionname=permissionname;
	   this.role=role;
	   
   }
   @Id
   @GeneratedValue(strategy=GenerationType.IDENTITY)
public Integer getId() {
	return id;
}

public void setId(Integer id) {
	this.id = id;
}
public String getPermissionname() {
	return permissionname;
}
public void setPermissionname(String permissionname) {
	this.permissionname = permissionname;
}

@ManyToOne(targetEntity=Role.class)
@JoinTable(name="t_role_permission",
		   joinColumns={@JoinColumn(name="permission_id")},
		   inverseJoinColumns={@JoinColumn(name="role_id")})
public Role getRole() {
	return role;
}
public void setRole(Role role) {
	this.role = role;
}
   
}
